package com.hardy.string;

/**
 * Author: fuxh3@lenovo.com
 * Date: Created in 2018/1/12 0012
 * 递归算法判断字符串是否是回文序列
 */
public class MoslemString {
    public static void main(String[] args) {
        String str = "123321";
        System.out.println(isMoslems(str,0,str.length()-1));
    }

    public static boolean isMoslems(String str, int low, int hight) {
        if (str.length() == 0 || str.length() == 1) {
            return true;
        }
        if(low==hight||low>hight){
            return true;
        }
        if(str.toCharArray()[low]==str.toCharArray()[hight]){
            return isMoslems(str,low+1,hight-1);
        }else{
            return false;
        }
    }
}
